#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time       :   21:23
# Author     : Y4
# Site       : 
# File       : 07 面向对象-继承is a.py
# Software   : PyCharm
'''
super().__init__(name)  # 父类对象
'''


class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def eat(self):
        print('我叫{},我今年{}岁了,我在吃饭'.format(self.name, self.age))

    def run(self):
        print('我叫{},我今年{}岁了,我在跑步'.format(self.name, self.age))


p = Person("张三", 18)
p.eat()


class Student(Person):
    def __init__(self, name, age, clazz):  # 重写自己的初始化
        super().__init__(name, age)
        self.clazz = clazz

    def study(self, course):
        print('{}正在学习{}课程'.format(self.name, course))

    def eat(self, foodName):  # 覆盖相同的方法
        print('{}正在吃饭,喜欢吃:{}'.format(self.name, foodName))


stu = Student('jack', 18, '三年一班')
stu.study('化学')
stu.eat('狮子头盖浇饭')
